(function($){
	$.pageUnit={
		headUnit:function(){
			var $head=$("#head");
			var ie6=$.browser.msie && $.browser.version==6.0;
			if(ie6){
				$(window).scroll(function(){
					$head.css({
						"position":"absolute",
						"top":$(window).scrollTop()+"px"
					});						  
				});	
			}
		},
		
		menuUnit:function(){
			var $li=$("ul.menu").find("li");
			$li.bind("mouseenter mouseleave",function(event){
				var $cLi=$(this);
				var $dropMenu=$cLi.find("div.drop_menu");
				var $clink=$cLi.find("a.main");
				$clink.bind("mouseenter mouseleave",function(event){
					if(event.type=="mouseenter"){
						$(this).addClass("hover").siblings("a.main").removeClass("hover");
					}
					if(event.type=="mouseleave"){
						
					}
					
				});
				if(event.type=="mouseenter"){
					$dropMenu.slideDown(200);
				}
				if(event.type=="mouseleave"){
					$dropMenu.css({
						"display":"none"	
					});
					$cLi.find("a.main").removeClass("hover");
				}
			});
				
		},
		
		menuMinWidth:function(){
			var winWidth=$(window).width();
			var mainA=$("#menu").find("a.main");
			var li=$("#menu").find("li");
			var head=$("#head");
			var headP=$("div.head");
			menuOpe();
			
			function menuOpe(){
				if(winWidth>1100){
					head.css({
						width:"100%"		 
					});
					mainA.css({
						padding:"3px 7px 3px"		  
					});
					li.css({
						padding:"10px 15px"   
					});
					headP.css({
						padding:"0 10px 0 50px"		  
					});
				}
				
				
				if(winWidth<=1100&&winWidth>980){
					head.css({
						width:"100%"		 
					});	
					mainA.css({
						padding:"3px 7px 3px"
					});
					li.css({
						padding:"10px 12px"   
					});
					headP.css({
						padding:"0 5px"		  
					});	
				}
			
				if(winWidth<=980){
					head.css({
						width:"980px"		 
					});
					mainA.css({
						padding:"5px"		  
					});
					li.css({
						padding:"10px 7px"   
					});
					headP.css({
						padding:"0 5px"		  
					});	
				}
				
				
			}
			
			$(window).resize(function(){
				winWidth=$(window).width();
				menuOpe();
			});
		},
		
		loginSortFunc:function(){
			var	loginMenu=$("#lsBox");
			var loginLink=$("#loginSort");
			var upArrow=loginMenu.find("span.up_arrow");
			var st=null;
			var hoverLink=true;
			loginLink.bind("mouseover mouseout",function(e){
				if(e.type=="mouseover"){
					if(loginMenu.css("display")=="block"){
						clearTimeout(st);
					}else{
						st=setTimeout(showLogin,500);
					}
				}
				if(e.type=="mouseout"){
					st=setTimeout(hideLogin,500);	
				}						
			});
			loginMenu.bind("mouseenter mouseleave",function(e){
				if(e.type=="mouseenter"){
					clearTimeout(st);
				}
				if(e.type=="mouseleave"){
					st=setTimeout(hideLogin,500);	
				}
			});
			
			function showLogin(){
				loginMenu.slideDown("fast",function(){
					upArrow.css({
						top:"-8px",
						left:"20px"	
					});									
				});			
			}
			function hideLogin(){
				loginMenu.slideUp();		
			}
		},
		
		rightWrapUnit:function(){
			var rWrap=$("div.gzw_content_box");
			var fWidth=rWrap.parent().width();
			var sWidth=rWrap.prev().outerWidth(true);
			rWrap.css({"width":fWidth-sWidth-2+"px"});
		}
		
		
	}
	
	
	
	
})(jQuery);

$(function(){
	//$.pageUnit.headUnit();  //IE6 menu position
	$.pageUnit.menuMinWidth(); //IE6 set minWidth
	$.pageUnit.menuUnit();
	$.pageUnit.loginSortFunc();
	$.pageUnit.rightWrapUnit();
});